home *** CD-ROM | disk | FTP | other *** search
- /*
- * rtp.h
- *
- * Constants and structures based on the 12/15/92 draft of the RTP protocol
- * Internet Draft. This information is still subject to change.
- *
- */
-
- #ifndef _rtp_h
- #define _rtp_h
-
- #define RTP_VERSION 1
-
- #define RTP_RETRANS 1
- #define RTP_REFILL (1<<1)
- #define RTP_LOCALBUF (1<<2)
- #define RTP_NOINPOLA (1<<3)
- #define RTP_SLOWVIDEO (1<<4) /* almost 30% slower, but may have higher Q */
- #define RTP_OVERIP (1<<5)
- #define RTP_OVERTCP (1<<6)
- #define RTP_NO_DEF (1<<7) /* otherwise, use UDP */
-
- #define RTP_OPT_UDELAY 1
- #define RTP_OPT_HDRLEN 2
- #define RTP_OPT_GROUPID 3
- #define RTP_OPT_ADDFLAG 4
- #define RTP_OPT_FLAGS 5
- #define RTP_OPT_QOS 6
-
- /* Offset from UNIX's epoch to the NTP epoch in seconds (NTP's JAN_1970) */
- #define RTP_EPOCH_OFFSET 2208988800
-
- /* Basic RTP header */
- typedef struct rtphdr {
- #ifndef LITTLE_BITFIELDS
- byte rh_vers:2; /* version */
- byte rh_flow:6; /* flow id */
- byte rh_opts:1; /* options present */
- byte rh_sync:1; /* end of synchronization unit */
- byte rh_content:6; /* content id */
- #else
- byte rh_flow:6; /* flow id */
- byte rh_vers:2; /* version */
- byte rh_content:6; /* content id */
- byte rh_sync:1; /* end of synchronization unit */
- byte rh_opts:1; /* options present */
- #endif
- u_short rh_seq; /* sequence number */
- longword rh_ts; /* time stamp (middle of NTP timestamp) */
- } rtphdr_t;
-
- /* Basic RTP option header */
- typedef struct rtpopthdr {
- #ifndef LITTLE_BITFIELDS
- byte roh_fin:1; /* final option flag */
- byte roh_type:7; /* option type */
- #else
- byte roh_type:7; /* option type */
- byte roh_fin:1; /* final option flag */
- #endif
- byte roh_optlen; /* option len */
- } rtpopthdr_t;
-
- /* Normal RTP options */
- #define RTPOPT_CSRC 0 /* Content source */
- #define RTPOPT_SSRC 1 /* Synchronization source */
- #define RTPOPT_BOP 2 /* Beginning of playout unit */
-
- /* RTP source (CSRC, SSRC) option header */
- typedef struct rtpsrchdr {
- #ifndef LITTLE_BITFIELDS
- byte rsh_fin:1; /* final option flag */
- byte rsh_type:7; /* option type */
- #else
- byte rsh_type:7; /* option type */
- byte rsh_fin:1; /* final option flag */
- #endif
- byte rsh_optlen; /* option len (== 2) */
- u_short rsh_uid; /* unique id within host */
- longword rsh_addr; /* IP address of host */
- } rtpsrchdr_t;
-
- /* RTP BOP option header */
- typedef struct rtpbophdr {
- #ifndef LITTLE_BITFIELDS
- byte rbh_fin:1; /* final option flag */
- byte rbh_type:7; /* option type */
- #else
- byte rbh_type:7; /* option type */
- byte rbh_fin:1; /* final option flag */
- #endif
- byte rbh_optlen; /* option len (== 1) */
- u_short rbh_seq; /* sequence number of BOP */
- } rtpbophdr_t;
-
- /* RTCP forward direction options */
- #define RTPOPT_CDES 32 /* Content description */
- #define RTPOPT_SDES 33 /* Source description */
- #define RTPOPT_FDES 34 /* Flow description */
- #define RTPOPT_BYE 35 /* Conference exit notification */
-
- /* RTCP CDESC option header */
- typedef struct rtcpcdeschdr {
- #ifndef LITTLE_BITFIELDS
- byte rtch_fin:1; /* final option flag */
- byte rtch_type:7; /* option type */
- #else
- byte rtch_type:7; /* option type */
- byte rtch_fin:1; /* final option flag */
- #endif
- byte rtch_optlen; /* option len */
- #ifndef LITTLE_BITFIELDS
- byte rtch_x1:2; /* reserved (must be 0) */
- byte rtch_content:6; /* content id */
- #else
- byte rtch_content:6; /* content id */
- byte rtch_x1:2; /* reserved (must be 0) */
- #endif
- byte rtch_x2; /* reserved (must be 0) */
- u_short rtch_rport; /* return port */
- byte rtch_cqual; /* clock quality */
- byte rtch_x3; /* reserved (must be 0) */
- longword rtch_cdesc; /* content descriptor */
- } rtcpcdeschdr_t;
-
- /* RTCP SDESC option header */
- typedef struct rtcpsdeschdr {
- #ifndef LITTLE_BITFIELDS
- byte rtsh_fin:1; /* final option flag */
- byte rtsh_type:7; /* option type */
- #else
- byte rtsh_type:7; /* option type */
- byte rtsh_fin:1; /* final option flag */
- #endif
- byte rtsh_optlen; /* total option len */
- u_short rtsh_uid; /* unique id within host */
- u_short rtsh_class; /* option class */
- byte rtsh_msglen; /* user option length */
- byte data; /* uses its address */
- } rtcpsdeschdr_t;
-
- /* RTCP BYE option header */
- typedef struct rtcpbyehdr {
- #ifndef LITTLE_BITFIELDS
- byte rtbh_fin:1; /* final option flag */
- byte rtbh_type:7; /* option type */
- #else
- byte rtbh_type:7; /* option type */
- byte rtbh_fin:1; /* final option flag */
- #endif
- byte rtbh_optlen; /* option len */
- u_short rtbh_uid; /* unique id within host */
- longword rtbh_addr; /* IP address of host */
- } rtcpbyehdr_t;
-
- /* RTCP reverse direction options */
- #define RTPOPT_QOS 64 /* Quality of service */
- #define RTPOPT_RAD 65 /* Raw application data */
-
- /* Basic RTCP reverse packet header */
- typedef struct rtcprevhdr {
- byte rtrh_flow; /* flow id */
- byte rtrh_x1; /* reserved (must be 0) */
- byte rtrh_x2; /* reserved (must be 0) */
- byte rtrh_x3; /* reserved (must be 0) */
- } rtcprevhdr_t;
-
- /* RTCP QOS option header */
- typedef struct rtcpqoshdr {
- #ifndef LITTLE_BITFIELDS
- byte rtqh_fin:1; /* final option flag */
- byte rtqh_type:7; /* option type */
- #else
- byte rtqh_type:7; /* option type */
- byte rtqh_fin:1; /* final option flag */
- #endif
- byte rtqh_optlen; /* option len (== 5) */
- u_short rtqh_uid; /* unique id within host */
- longword rtqh_addr; /* IP address of host */
- u_short rtqh_precv; /* packets received */
- u_short rtqh_seqrange; /* sequence number range */
- u_short rtqh_mindel; /* minimum delay */
- u_short rtqh_maxdel; /* maximum delay */
- u_short rtqh_avgdel; /* average delay */
- u_short rtqh_x; /* reserved (must be 0) */
- } rtcpqoshdr_t;
-
- /* LBL MOVIE & TEST */
- typedef struct rtcp_movie {
- u_short group_id; /* frame ID */
- short size; /* window size */
- byte fragment; /* number of fragments in this group (frame) */
- #ifndef LITTLE_BITFIELDS
- byte fin_p:1; /* final packet; assemble now */
- byte ttl:7; /* time to live; max is 128 ms. */
- #else
- byte ttl:7;
- byte fin_p:1;
- #endif
- u_short linewidth; /* image (scan line) width */
- byte type; /* protocol. can be used for extended header */
- /* number bytes for more options that follows this header */
-
- byte pkt_id; /* fragment (packet) ID */
- short command; /* reserved; */
- union {
- struct {
- u_short x, y; /* used for linewidth presented */
- } cord;
- longword pos; /* absolute offset */
- } offset; /* fragment start offset */
- longword total_len; /* total data in this group (frame) */
- } rtcp_movie_t;
- #define TOTAL_RTP_MOVIE_HEADER_BYTES \
- (sizeof(rtphdr_t) + sizeof(rtcpsdeschdr_t) + sizeof(rtcp_movie_t))
-
- /* RTP standard content encodings for audio */
- #define RTPCONT_PCMU 0 /* 8kHz PCM mu-law mono */
- #define RTPCONT_1016 1 /* 8kHz CELP (Fed Std 1016) mono */
- #define RTPCONT_G721 2 /* 8kHz G.721 ADPCM mono */
- #define RTPCONT_GSM 3 /* 8kHz GSM mono */
- #define RTPCONT_G723 4 /* 8kHz G.723 ADPCM mono */
- #define RTPCONT_DVI 5 /* 8kHz Intel DVI ADPCM mono */
- #define RTPCONT_L16_16 6 /* 16kHz 16-bit linear mono */
- #define RTPCONT_L16_44_2 7 /* 44.1kHz 16-bit linear stereo */
-
- /* RTP standard content encodings for video */
- #define RTPCONT_CUSEEME 27 /* Cornell CU-SeeMe */
- #define RTPCONT_NV 28 /* Xerox PARC nv */
- #define RTPCONT_DVC 29 /* BBN dvc */
- #define RTPCONT_BOLT 30 /* Bolter */
- #define RTPCONT_H261 31 /* CCITT H.261 */
-
- #define RTPCONT_MOVIE 48 /* LBL MOVIE */
- #define RTPCONT_TEST 49 /* RTP TEST MODE */
-
- #endif /*_rtp_h*/
-